package cn.project.xigui.web;

import lombok.Data;

/**
 * 给web响应的封装Json信息的类
 */
@Data
public class JsonResult {
    /**
     * 操作结果的状态码
     */
    private Integer code;
    /**
     * 操作失败的提示文本
     */
    private String message;

    public static JsonResult success(){
        JsonResult jsonResult = new JsonResult();
        jsonResult.code = ServiceCode.SUCCESS.getCode();
        return jsonResult;
    }
    public static JsonResult fail(ServiceCode serviceCode,String message){
        JsonResult jsonResult = new JsonResult();
        jsonResult.code = serviceCode.getCode();
        jsonResult.message = message;
        return jsonResult;
    }
}
